package org.dromara.exam.domain.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.ibatis.type.JdbcType;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.exam.domain.dto.AnswerExamInfo;
import org.dromara.exam.domain.dto.AnswerMetaInfo;
import org.dromara.exam.domain.dto.TemplateSchema;
import org.dromara.exam.enums.ExamExerciseTypeEnum;

import java.io.Serial;
import java.util.LinkedHashMap;

/**
 * 答题对象 exam_answer
 *
 * @author xiyin321
 * @date 2024-05-24
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName(value = "exam_answer", autoResultMap = true)
public class ExamAnswer extends BaseEntity {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     *
     */
    @TableId(value = "id")
    private Long id;

    /**
     * 项目ID
     */
    private Long projectId;


    /**
     * 项目内容
     */
    @TableField(typeHandler = JacksonTypeHandler.class, jdbcType = JdbcType.LONGVARCHAR)
    private TemplateSchema survey;

    /**
     * 暂存答案
     */
    @TableField(typeHandler = JacksonTypeHandler.class, jdbcType = JdbcType.LONGVARCHAR)
    private LinkedHashMap<String, Object> tempAnswer;

    /**
     * 答案
     */
    @TableField(typeHandler = JacksonTypeHandler.class, jdbcType = JdbcType.LONGVARCHAR)
    private LinkedHashMap<String, Object> answer;

    /**
     * 项目数据
     */
    @TableField(typeHandler = JacksonTypeHandler.class, jdbcType = JdbcType.LONGVARCHAR)
    private AnswerMetaInfo metaInfo;

    /**
     * 0暂存 1已完成
     */
    private String tempSave;

    /**
     * 考试信息
     */
    @TableField(typeHandler = JacksonTypeHandler.class, jdbcType = JdbcType.LONGVARCHAR)
    private AnswerExamInfo examInfo;

    /**
     * 考试练习类型
     */
//    private ExamExerciseTypeEnum examExerciseType;

    /**
     * 考试分数
     */
    private Double examScore;

    /**
     * 删除标志
     */
    @TableLogic
    private String delFlag;

    /**
     * 备注信息
     */
    private String remark;

}
